package jifenbao.com.jifenbao;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by longteng on 2016-5-23.
 */
public class ShopList extends AppCompatActivity{
    private ListView shoplistView;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shoplist);

        shoplistView = (ListView)findViewById(R.id.shoplist);
        List<Map<String,String>> shopView = new ArrayList<>();
        for(int i=1;i<5;i++) {
            Map<String, String> shopmap1 = new HashMap<>();
            shopmap1.put("shop_name", "卡路里先生（上地店）");
            shopmap1.put("shop_dial", "010 86905600");
            shopmap1.put("shop_add", "北京市海淀区上地七街环岛路8号");
            shopView.add(shopmap1);

            Map<String, String> shopmap2 = new HashMap<>();
            shopmap2.put("shop_name", "卡路里先生（五道口店）");
            shopmap2.put("shop_dial", "010 86905600");
            shopmap2.put("shop_add", "北京市五道口华联4层105号");
            shopView.add(shopmap2);

            Map<String, String> shopmap3 = new HashMap<>();
            shopmap3.put("shop_name", "卡路里先生（中关村店）");
            shopmap3.put("shop_dial", "010 86905600");
            shopmap3.put("shop_add", "北京市中关村大街108号");
            shopView.add(shopmap3);
        }
        SimpleAdapter myAdapter = new SimpleAdapter(this,shopView,R.layout.activity_shoplist_item,
                new String[]{"shop_name","shop_dial","shop_add"},
                new int[]{R.id.shop_name,R.id.shop_dial,R.id.shop_add});
        shoplistView.setAdapter(myAdapter);
    }
}
